﻿//-----------------------------------------------------------------------
// <copyright file="ExceptionBuilder.cs" company="Numbrella foundation">
// Copyright (c) Numbrella foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Numbrella.Core
{
	using System;
	using System.Diagnostics;
	
	/// <summary>
	/// Helper for throwing exceptions with tracing.
	/// </summary>
	internal static class ExceptionBuilder
	{
		/// <summary>
		/// Throws <see cref="InvalidOperationException"/>.
		/// </summary>
		/// <param name="message">Exception message.</param>
		public static void ThrowInvalidOperationException(string message)
		{
			Trace.TraceError(message);
			throw new InvalidOperationException(message);
		}

		/// <summary>
		/// Throws <see cref="ArgumentNullException"/>.
		/// </summary>
		/// <param name="argumentName">Argument name.</param>
		public static void ThrowArgumentNullException(string argumentName)
		{
			throw new ArgumentNullException(argumentName);
		}

		/// <summary>
		/// Throws <see cref="ArgumentException"/>.
		/// </summary>
		/// <param name="argumentName">Argument name.</param>
		/// <param name="message">Exception message.</param>
		public static void ThrowArgumentException(string argumentName, string message)
		{
			throw new ArgumentException(message, argumentName);
		}
	}
}
